prefix=/usr

all:

bin/windown: bin/windown.c
	$(CC) `python-config --cflags --embed` `python-config --ldflags --embed` $< -o $@

install: bin/windown
	install -d -m 0755 "$(DESTDIR)/$(prefix)/bin"
	install -m 2755 -g windown bin/windown "$(DESTDIR)/$(prefix)/bin"

	install -d -m 0755 "$(DESTDIR)/$(prefix)/lib/windown"
	cp -r lib/* "$(DESTDIR)/$(prefix)/lib/windown"
	find "$(DESTDIR)/$(prefix)/lib/windown" -type f | xargs chmod 644
	find "$(DESTDIR)/$(prefix)/lib/windown" -type d | xargs chmod 755

	install -d -m 0755 "$(DESTDIR)/lib/tmpfiles.d"
	install -m 0644 data/windown.conf "$(DESTDIR)/lib/tmpfiles.d"

.PHONY: all install
